

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>试卷管理</title>
    <#include "/common/link.ftl">

</head>
<body class="hold-transition skin-black sidebar-mini">
<div class="wrapper">
    <#include "/common/navbar.ftl">
    <#assign currentMenu="exam"/>
    <#include "/common/menu.ftl">
    <div class="content-wrapper">
        <section class="content-header">
            <h1>试卷编辑</h1>
        </section>
        <section class="content">
            <div class="box" style="padding: 10px">
                <form class="form-horizontal" action="/exam/input" method="post" id="editForm" >

                    <input type="hidden"  name="id">
                    <div class="form-group"  style="margin-top: 10px;">
                        <label  class="col-sm-2 control-label">试卷名称：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="title"  placeholder="请输入试卷名称">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">考试时长：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="examMinute"  placeholder="请输入考试时长">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">单选题：</label>

                        <div class="col-sm-3">
                            <input type="text" class="form-control" name="singleChoice"  placeholder="请输入随机组题数量">
                        </div>

                        <div class="col-sm-3">
                            <input type="text" class="form-control"  name="singleScore" placeholder="请输入每题分数">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">多选题：</label>

                        <div class="col-sm-3">
                            <input type="text" class="form-control" name="multipleChoice"  placeholder="请输入随机组题数量">
                        </div>

                        <div class="col-sm-3">
                            <input type="text" class="form-control" name="multipleScore"  placeholder="请输入每题分数">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">判断题：</label>

                        <div class="col-sm-3">
                            <input type="text" class="form-control" name="judgeChoice"  placeholder="请输入随机组题数量">
                        </div>

                        <div class="col-sm-3">
                            <input type="text" class="form-control" name="judgeScore"  placeholder="请输入每题分数">
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-sm-offset-6 col-sm-6">
                            <button type="button" class="btn btn-primary btn-submit">生成试卷</button>
                            <a href="javascript:window.history.back()" class="btn btn-danger">取消</a>
                        </div>
                    </div>
                </form>
            </div>
        </section>
    </div>
    <#include "/common/footer.ftl">
</div>
<script>
    $(".btn-submit").click(function () {
        let jQuery = $("#editForm").serialize();
        console.log(jQuery);
        $.post("/exam/saveOrUpdate",jQuery ,function (data) {



            if (data) {
                Swal.fire({
                    icon: 'success',
                    title: "生成成功",
                    confirmButtonText: "确认",
                }).then((result) => {
                    window.location.href = "/exam/preview?id="+data.id;
                })
            } else {
                Swal.fire(
                    '操作失败!',
                    'error'
                )
            }
        })
    })
</script>
</body>
</html>
